﻿using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace Base.ModuleBase
{
    public abstract class ModuleBase : IModule
    {
        #region 成员
        /// <summary>
        /// 注册管理对象
        /// </summary>
        public IContainerRegistry ContainerRegistry;

        /// <summary>
        /// 
        /// </summary>
        public IContainerProvider ContainerProvider;

        /// <summary>
        /// 页面管理对象
        /// </summary>
        public IRegionManager RegionManager;
        #endregion

        #region 方法
        public void OnInitialized(IContainerProvider containerProvider)
        {
            ContainerProvider = containerProvider;
            RegionManager = ContainerProvider.Resolve<IRegionManager>();
            RegisterViews();
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            ContainerRegistry = containerRegistry;
        }

        /// <summary>
        /// 注册页面
        /// </summary>
        /// <param name="rm"></param>
        protected abstract void RegisterViews(); 
        #endregion
    }
}